'use strict';

import React, { Component } from 'react';
import {

  ScrollView,
  RefreshControl,
} from 'react-native';

import PropTypes from 'prop-types';

/**
 * 使用方法  具体参考 pull 页面
 * 
 * import Pull from "../components/pull";
 * 
 *  <Pull
          freshDom={this.renderItem.bind(this)}
          onRefresh={this._onRefresh.bind(this)}
        />
  
 

 */

export default class PullScreen extends Component {
  static defaultProps = {
  
    refreshing: false,
    colors=['rgb(255, 176, 0)',"#ffb100"]


  };

  static propTypes = {
    colors: PropTypes.array,
    onRefresh: PropTypes.func,
    freshDom:PropTypes.element,
  }


  constructor(props) {
    super(props);
  }
 
 

  render() {
    const {
      freshDom,
      refreshing,
      colors,
      progressBackgroundColor,
      onRefresh,

    } = this.props;
    return (
   
        <ScrollView
          refreshControl={
            <RefreshControl
              refreshing={refreshing}
              colors={colors}
              progressBackgroundColor={progressBackgroundColor}
              onRefresh={onRefresh}
            />
          }
        >
        {freshDom}
        </ScrollView>
   
    );
  }
}

